import { Navigate } from 'react-router-dom'

const getToken = ()=>{
    return sessionStorage.getItem('token')
}

function AuthRouter ({children}){
    const token = getToken()
    if(token){
        return <>{children}</>
    }else{
        return <Navigate to={'/login'}></Navigate>
    }
}
export default AuthRouter